<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <base href="<%=basePath%>">

    <title>My JSP 'add.jsp' starting page</title>

    <link href="<%=request.getContextPath() %>/css/add.css" type="text/css" rel="stylesheet">
    <script src="/js/jquery-3.7.1.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $("[name=clubName]").blur(() => {
                // 发出ajax请求
                $.get("/club/checkName", {name: $("[name=clubName]").val()}, (data) => {
                    if (data) {
                        $("#mySpan").html("<img src='/img/no.png'>社团名已存在");
                    } else {
                        $("#mySpan").html("<img src='/img/ok.png'>");
                    }
                })
            })
        })
    </script>
</head>

<body>
<div id="up">
    <ul>
        <li><span><a href="#">社团管理 </a>&gt; 创建社团 &gt;</span></li>
    </ul>
</div>
<div id="down">
    <form method="post" action="/club/addClub">
        <table width="800px">
            <%--				<tr>--%>
            <%--					<td>社团编号：</td>--%>
            <%--					<td><input type="text" name="clubID" value="${Club.clubID}" readonly class="in"/></td>--%>
            <%--				</tr>--%>
            <tr>
                <td>社团名称：</td>
                <td><input type="text" name="clubName" value="${Club.clubName}" class="in"/><span id="mySpan"></span>
                </td>
            </tr>
            <tr>
                <td>社团级别：</td>
                <td><input type="text" name="level" value="${Club.level}" class="in"/></td>
            </tr>
            <tr>
                <td>社团风采：</td>
                <td><input type="text" name="clubStyle" value="${Club.clubStyle}" class="in"/></td>
            </tr>
            <tr>
                <td>社团招新：</td>
                <td><input type="text" name="clubRecruitment" value="${Club.clubRecruitment}" class="in"/></td>
            </tr>
            <tr>
                <td>联系我们：</td>
                <td><input type="text" name="contactUs" value="${Club.contactUs}" class="in"/></td>
            </tr>
            <tr>
                <td>社团创建者：</td>
                <td><input type="text" name="founder" value="${Club.founder}" class="in"/></td>
            </tr>
            <tr>
                <td>
                    <input type="submit" value="提&nbsp;&nbsp;&nbsp;交" class="su">
                </td>
                <td>
                    <input type="reset" value="清&nbsp;&nbsp;&nbsp;空" class="su">
                </td>
            </tr>
        </table>
    </form>
</div>
</body>
</html>
